package com.lmk.mkcc.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.lmk.mkcc.constants.RedisSystemdictionaryConstants;
import com.lmk.mkcc.domain.Systemdictionaryitem;
import com.lmk.mkcc.mapper.SystemdictionaryitemMapper;
import com.lmk.mkcc.service.ISystemdictionaryitemService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kun
 * @since 2022-09-23
 */
@Service
@Slf4j
public class SystemdictionaryitemServiceImpl extends ServiceImpl<SystemdictionaryitemMapper, Systemdictionaryitem> implements ISystemdictionaryitemService {
        @Autowired
        private RedisTemplate<Object,Object> redisTemplate;

    @Override
    @Cacheable(cacheNames = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_NAMES,key = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_KEY)
    public Page<Systemdictionaryitem> selectPage(Page<Systemdictionaryitem> page) {
        return super.selectPage(page);
    }

    @Override
    @CacheEvict(cacheNames = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_NAMES,key = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_KEY)
    public boolean insert(Systemdictionaryitem entity) {
        return super.insert(entity);
    }

    @Override
    @CacheEvict(cacheNames = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_NAMES,key = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_KEY)
    public boolean deleteById(Serializable id) {
        return super.deleteById(id);
    }

    @Override
    @CacheEvict(cacheNames = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_NAMES,key = RedisSystemdictionaryConstants.SYSTEM_DICTIONARYITEM_KEY)
    public boolean updateById(Systemdictionaryitem entity) {
        return super.updateById(entity);
    }
}
